<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2017/10/27
  Time: 2:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="jquery-1.8.3.js"></script>
    <script type="text/javascript">
        $(function () {
            $("a").click(function () {
                //args:Json格式
                //function:回调函数：当响应结束时，回调函数被触发。响应结果在data变量中
                var url = this.href;
                var args = {"time": new Date()};
                //该方法是jQuery对象的方法。
                $.get(url, args, function (data) {
                    var name = $(data).find("name").text();
                    var email = $(data).find("email").text();
                    var website = $(data).find("website").text();
                    $("#details").empty()
                        .append("<h2><a href='mailto:" + email + "'>" + name + "</a></h2>")
                        .append("<a href='" + website + "'>" + website + "</a>");
                })//这个结果在回调函数的参数中
                return false;
            })
        })
    </script>
</head>
<body>
<h1>people</h1>
<ul>
    <LI><a HREF="files/andy.xml">Andy</a></LI>
    <LI><a href="#">Richard</a></LI>
    <LI><a href="#">Jermy</a></LI>
</ul>
<div id="details"></div>
</body>
</html>
